import sys
import functools
from PyQt5.QtCore import pyqtSlot, Qt
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QHBoxLayout, QCheckBox, QButtonGroup,QLabel, QMessageBox

def on_delete_clicked():
    result = QMessageBox.question(w, "删除提示", "确定要删除***吗？",
                                  buttons= QMessageBox.Ok | QMessageBox.Cancel,
                                  defaultButton= QMessageBox.Cancel)
    
    if result == QMessageBox.Ok:
        print("确认删除")
    else:
        print("取消")
        
def init_widget(w : QWidget):
    w.setWindowTitle("消息对话框")
    w.resize(640, 480)
    layout = QHBoxLayout()
    w.setLayout(layout)
    
    btn = QPushButton("删除用户")
    btn.clicked.connect(on_delete_clicked)
    layout.addWidget(btn)
    
if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = QWidget()
    init_widget(w)
    w.show()
    sys.exit(app.exec_())
